package com.flowerSystem.service.impl;

import com.flowerSystem.entity.User;
import com.flowerSystem.mapper.UserMapper;
import com.flowerSystem.service.UserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.flowerSystem.util.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 鲜花遇上牛战士
 * @since 2023-08-28
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
    @Autowired
    UserMapper userMapper;

    @Override
    public int removeUserRole(int user_id) {
        userMapper.removeUserRole(user_id);
        return 0;
    }

    @Override
    public boolean upUser(User user) {
        int user_id = userMapper.insertUser(user);
        userMapper.insertUserRole(user.getId());
        if (user_id>0){
            return true;
        }
        return false;
    }

    @Override
    public List<User> allEmployeeUser() {
        List<User> list =userMapper.selectUserList();
        return list;
    }

    @Override
    public List<User> getUser() {
        return userMapper.getUser();
    }
}
